<?php
/**
 * Created by PhpStorm.
 * User: YH
 * Date: 2019/5/11
 * Time: 14:31
 */


header("Access-Control-Allow-Origin:*");
header("Content-Type:application/json;charset=utf-8");
include "dbHelper.php";

if ($_SERVER["REQUEST_METHOD"]=="POST"){
        sleep(2);
    if ((isset($_REQUEST["uname"])&&isset($_REQUEST["upwd"]))){
        $UNAME=$_POST["uname"];
        $UPWD=$_POST["upwd"];
        $UEMAIL=$_POST["uemail"];

        $sql="INSERT INTO `userinfo` (`u_name`,`u_pwd`,`u_email`) 
VALUES ('".$UNAME."','".$UPWD."','".$UEMAIL."')";

        $result=dbHelper($sql);

        if ($result>=1){
            print_r(json_encode(Array("msg"=>"注册成功","status"=>1)));
        }else{
            print_r(json_encode(Array("msg"=>"注册失败","status"=>0)));
        }

    }
}else{
    print_r(json_encode(Array("msg"=>"不支持get请求","status"=>-1)));
}














